package com.bwie.controller;

import com.bwie.common.domain.Organization;
import com.bwie.common.result.Result;
import com.bwie.service.OrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @className: OrganizationController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 汪菲阳
 * @date: 2025/10/22 12:08
 */
@CrossOrigin
@RestController
@RequestMapping("/org")
public class OrganizationController {
    @Autowired
    private OrganizationService organizationService;

    /**
     * 添加组织
     * @param organization
     * @return
     */
    @PostMapping("addOrganization")
    public Result addOrganization(@RequestBody Organization organization){
        organizationService.addOrganization(organization);
        return Result.success();
    }

    @GetMapping("organizationList")
    public Result<List<Organization>> organizationList(){
        return Result.success(organizationService.organizationList());
    }
}
